//
//  ELSearchTableViewCell.swift
//  WZApp
//
//  Created by evol on 2018/7/3.
//  Copyright © 2018年 evol. All rights reserved.
//

import UIKit
import RxSwift
import RxCocoa

class ELSearchTableViewCell: UITableViewCell {

    private(set) var disposeBag = DisposeBag()
    
    private var label:UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexColor("6b4611")
        label.font = UIFont.systemFont(ofSize: 14)
        label.numberOfLines = 0
        return label
    }()
    
    var button:UIButton = {
        let button = UIButton(type: .custom)
        button.setImage(UIImage(named: "icon_search_togo"), for: .normal)
        return button
    }()
    
    var model:ELTagModel? {
        willSet{
            label.text = newValue?.name
        }
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.backgroundColor = .clear
        self.contentView.backgroundColor = .clear
        

        contentView.addSubview(label)
        label.snp.makeConstraints { (make) in
            make.centerY.equalTo(contentView)
            make.left.equalTo(10)
            make.top.equalTo(13)
            make.bottom.equalTo(-13)
        }
        
        contentView.addSubview(button)
        button.snp.makeConstraints { (make) in
            make.right.equalTo(-10)
            make.centerY.equalTo(contentView)
        }
        
        // 分割线
        let line = UIView()
        line.backgroundColor = UIColor.black.withAlphaComponent(0.4)
        contentView.addSubview(line)
        line.snp.makeConstraints {
            $0.bottom.equalTo(contentView)
            $0.left.equalTo(10)
            $0.right.equalTo(-10)
            $0.height.equalTo(0.5)
        }
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
